<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>线上测试网页</title>
    <script src="./rem/rem.js"></script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        .btnbox {
            width: 100%;
            display: flex;
        }

        .btnbox div {
            flex: 1;
            text-align: center;
            border: 1px solid #ccc;
            line-height: 1rem;
            font-size: 0.4rem;
        }

        #result2,
        #xingwei {
            font-size: 0.4rem;
            padding: 0.4rem;
        }

        input,
        button {
            line-height: 0.7rem;
        }

        #xingwei span:nth-last-child(1) {
            color: green;
        }

        .yingd {
            padding: 0.1rem;
            background-color: #ccc;
            overflow-x: scroll;
        }

        .btn {
            text-align: center;
            /* width: 100%; */
            padding: 10px;
            /* line-height: 40px; */
            text-align: center;
            background: #D7000A;
            color: #fff;
            border-radius: 5px;
        }

        .uni-container {
            background: rgba(0, 0, 0, 0.1);
        }

        .rizhi {
            padding: 20px;
        }

        #putongxianshi {
            font-size: 0.4rem;
        }
    </style>
</head>

<body>
    <div class="btnbox">
        <div id="xhrshend">
            发送请求13次
        </div>
        <div id="tojijin">
            request 13次请求
        </div>
        <!-- <div id="tojijin2">
				跳转基金
			</div> -->
    </div>
    <div class="btnbox">
        <div id="yuans">
            跳转到基金详情
        </div>
    </div>
    <!-- <div class="btnbox">
			<input type="number" name="" id="input" style="flex: 1;" placeholder="请输入并发数量"><button style="width: 2rem;"
				id="btn">加载</button>
		</div> -->
    <div id="putongxianshi">

    </div>
    <div id="result2">

    </div>
    <!-- uni 的 SDK -->
    <script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.1/index.js"></script>
    <script type="text/javascript" src="https://appx/web-view.min.js"></script>
    <!-- 微信 JS-SDK 如果不需要兼容小程序，则无需引用此 JS 文件。 -->
    <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
    <!-- uni 的 SDK，必须引用。 -->
    <script type="text/javascript" src="//js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.0.1.52.js"></script>
    <script src="./jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/vue/vue.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/vue/vue-tap.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/vant/vant@2.12.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/c/TZT.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/c_modules/sea.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/common/js/seajs-css.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/iscroll/iscroll-probe.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/lodash/lodash.min.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/native/native_bridge.js"></script>
    <script type="text/javascript"
        src="http://123.103.83.18:17777/z_modules/recordWithLabel/recordWithLabel.js"></script>
    <script type="text/javascript" src="http://123.103.83.18:17777/z_modules/polyfill.min.js"></script>
    <script>
        if (navigator.userAgent.indexOf('AlipayClient') > -1 || navigator.userAgent.indexOf('mPaaSClient') > -1) {
            document.writeln('<script src="https://appx/web-view.min.js"' + '>' + '<' + '/' + 'script>');
        }
        my.getEnv(function (res) {
            console.log(res.miniprogram); //true
        });
        console.log(my)
        var jsonsuccess = {}
        // 回退页面调用函数
        window.GoBackOnLoad = function () {
            console.log('回退页面调用函数')
        }
        // 页面失去焦点
        window.onDisappear = function () {
            console.log('页面失去焦点')
        }
        // 页面得到焦点
        window.onAppear = function () {
            console.log('页面得到焦点')
        }

        window.onSaveTradeSettings = function () {
            console.log('onSaveTradeSettings')
        }
        // 页面从遮挡状态恢复为显示状态
        window.onReshow = function () {
            console.log('页面从遮挡状态恢复为显示状态')
        }
        var index = -1
        var xhrshend = document.querySelector('#xhrshend')
        var tojijin = document.querySelector('#tojijin')
        var result2 = document.querySelector('#result2')
        window.onAppear = function () {
            index++
            // 页面可视
            result2.innerHTML += "<div class='child'>触发事件：onAppear</div>"
        };
        var indexa = 0
        yuans.onclick = function () {
            my.navigateTo({ url: '../get-user-info/get-user-info' });
        }
        my.onMessage = function (e) {
            console.log(e); //{'sendToWebView': '1'}
        }
        tojijin.onclick = function () {
            for (var i = 0; i < 13; i++) {
                getdatauni(i)
            }
        }
        function uid4() {
            function S4() {
                return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
            }
            return (S4() + S4() + "" + S4() + "" + S4() + "" + S4() + "" + S4() + S4() + S4());
        }
        window.successd = function (data) {
            console.log(data)
            jsonsuccess[data.keyid][data.type](data)
        }

        function getdatauni(index) {
            var keyid = uid4()
            jsonsuccess[keyid] = {
                putnum:index,
                success: function (data) {
                    console.log(data)
                    var time1 = new Date
                    var str = `
								<div style="margin-bottom:10px">
									<p>请求 ; time ${time1.getTime() - data.timeStamp} s</p>
									<p>内容：成功</p>
									<p style="max-height: 80px;background: rgba(0, 0, 0, 0.1);word-break: break-all;white-space: pre-wrap;overflow-y: scroll;">${JSON.stringify(data.data)}</p>
								</div>
								`
                    putongxianshi.innerHTML += str
                },
                fail: function (data) {
                    console.log(data)
                    var time1 = new Date
                    var str = `
								<div style="margin-bottom:10px">
									<p>请求 ; time ${time1.getTime() - data.timeStamp} s</p>
									<p>内容：失败</p>
									<p style="max-height: 80px;background: rgba(0, 0, 0, 0.1);word-break: break-all;white-space: pre-wrap;overflow-y: scroll;">${JSON.stringify(data.data)}</p>
								</div>
								`
                    putongxianshi.innerHTML += str
                }
            }
            var json = {
                url: "https://httpbin.org/post",
                type: 'POST',
                data: {
                    from: '支付宝',
                    production: 'AlipayJSAPI',
                },
                dataType: "json",
                keyid: keyid
            }
            my.postMessage(json);
        }
        window.onDisappear = function () {
            index++
            // 页面消失
            result2.innerHTML += "<div class='child'>触发事件：onDisappear</div>"
        };
        var putnum = 0
        xhrshend.onclick = function () {
            var www = parseInt(Math.random() * 999 + 100)
            for (var i = 0; i < 13; i++) {
                putongDom()
            }
        }
        function putongDom() {
            putnum++
            index++
            getdata(putnum)
        }

        function getdata(index) {
            var putnum = index
            var time = new Date
            $.ajax({
                url: 'http://123.103.83.56:8000/api/v3/account/get?sysNo=CS118&token=eyJjaWQiOiJDU18yYmM4MDZiMTczIiwiZERhdGUiOiIxNjY2NTk3ODU1NTMyIiwia2V5dCI6IjE2%250ANjAxODE4NjI1OTQiLCJ0b2tlbiI6ImJhNDM4ZTFlMWEwYWI4YWU4OTFhMjZkYTczNzhjNDZiZjcz%250AMzg4MDUiLCJ0b2tlbkhlYWQiOiJMVDAwMTAiLCJ0b2tlbklkIjoiRkVXN1pNQzFXNDlFNFU0UDdR%250AWjAifQ%253D%253D&_=1668421690842',
                type: 'get',
                success: function (data) {
                    var time1 = new Date
                    var str = `
								<div style="margin-bottom:10px">
									<p>请求 ${putnum}; time ${time1.getTime() - time.getTime()} s</p>
									<p>内容：成功</p>
									<p style="max-height: 80px;background: rgba(0, 0, 0, 0.1);word-break: break-all;white-space: pre-wrap;overflow-y: scroll;">${JSON.stringify(data)}</p>
								</div>
								`
                    putongxianshi.innerHTML += str
                },
                error: function (err) {
                    var time1 = new Date
                    var str = `
								<div style="margin-bottom:10px">
									<p>请求 ${putnum}; time ${time1.getTime() - time.getTime()} s</p>
									<p>内容：失败</p>
									<p style="max-height: 80px;background: rgba(0, 0, 0, 0.1);word-break: break-all;white-space: pre-wrap;overflow-y: scroll;">${JSON.stringify(err)}</p>
								</div>
								`
                    putongxianshi.innerHTML += str
                }
            })
        }
    </script>
</body>
<script src="./vconsole.min.js"></script>
<script>
    var vConsole = new VConsole();
</script>

</html>